// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

//使用路由的钩子函数
router.beforeEach((to,from ,next)=> {
  console.log(`从 ${from.path} 进入 => ${to.path}`);
  next(); //可接受参数,如果为false将中断导航
});
router.afterEach(function (transition) {
});

//网络请求
import Api from './utils/ApiUtils'
Vue.prototype.$post = (u,b) => Api.post(u,b);
Vue.prototype.$Api = Api;

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})
